import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
import org.junit.Test;

import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;

public class test00 {
    public static SecretKey generalKey(){
        byte[] decode = Base64.getDecoder().decode("itcast");
        return new SecretKeySpec(decode,0,decode.length,"AES");
    }

    @Test
    public void parseJWT() throws Exception{
        String jwt = "eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJiZWEzMWRkYi1hZDQyLTRhMDMtODZkYy02MDIyMGQwMmRmNTYiLCJzdWIiOiJ1c2VyIiwiaXNzIjoiYWRtaW4iLCJpYXQiOjE1ODM0MjUzOTgsImV4cCI6MTU4MzQyODc1OH0.FVL6mrI9rWVlsW3WPyesPyLaG2LC5W3jiSenCLg8ih0";
        SecretKey secretKey = generalKey();
        Claims claims = Jwts.parser().setSigningKey(secretKey).parseClaimsJws(jwt).getBody();
        System.out.println(claims);
    }
}
